/*************************************************************************
	> File Name: 2.exec.c
	> Author: WangYiFei
	> Mail: 824537320@qq.com
	> Created Time: Sun 10 Jan 2021 07:54:47 PM CST
 ************************************************************************/

#include "head.h"

int main() {
    pid_t pid;
    if ((pid = fork()) < 0) {
        perror("fork()");
        exit(1);
    }
    if (pid == 0) {
        execl("./a.out", "./a.out", "2.exec.c", NULL);
        printf("In End!\n");
    } else {
        // 不用管孩子是怎么死的
        wait(NULL);
        printf("After Child terminated\n");
        sleep(5);
    }

    return 0;
}

